/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.isn.examenes.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author pool
 */
@Entity
@Table(name = "tipo_de_examen")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TipoDeExamen.findAll", query = "SELECT t FROM TipoDeExamen t"),
    @NamedQuery(name = "TipoDeExamen.findByCodTipoExa", query = "SELECT t FROM TipoDeExamen t WHERE t.codTipoExa = :codTipoExa"),
    @NamedQuery(name = "TipoDeExamen.findByDesTipoExa", query = "SELECT t FROM TipoDeExamen t WHERE t.desTipoExa = :desTipoExa")})
public class TipoDeExamen implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Cod_Tipo_Exa", columnDefinition="CHAR(5) unsigned")
    private String codTipoExa;
    @Column(name = "Des_Tipo_Exa")
    private String desTipoExa;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codTipoExa")
    private Collection<Examen> examenCollection;

    public TipoDeExamen() {
    }

    public TipoDeExamen(String codTipoExa) {
        this.codTipoExa = codTipoExa;
    }

    public String getCodTipoExa() {
        return codTipoExa;
    }

    public void setCodTipoExa(String codTipoExa) {
        this.codTipoExa = codTipoExa;
    }

    public String getDesTipoExa() {
        return desTipoExa;
    }

    public void setDesTipoExa(String desTipoExa) {
        this.desTipoExa = desTipoExa;
    }

    @XmlTransient
    public Collection<Examen> getExamenCollection() {
        return examenCollection;
    }

    public void setExamenCollection(Collection<Examen> examenCollection) {
        this.examenCollection = examenCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codTipoExa != null ? codTipoExa.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoDeExamen)) {
            return false;
        }
        TipoDeExamen other = (TipoDeExamen) object;
        if ((this.codTipoExa == null && other.codTipoExa != null) || (this.codTipoExa != null && !this.codTipoExa.equals(other.codTipoExa))) {
            return false;
        }
        return true;
    }
    
}
